<template>
  <Card>
    <div class="w-full h-50px" ref="chartRef"></div>
  </Card>
</template>

<script lang="ts">
  import { defineComponent } from 'vue';
  export default defineComponent({
    name: 'ProgressChart',
  });
</script>

<script lang="ts" setup>
  import { ref, onMounted } from 'vue';
  import { Card } from 'ant-design-vue';
  import * as echarts from 'echarts';

  const chartRef = ref();

  onMounted(() => {
    const myEcharts = echarts.init(chartRef.value);
    const option = {
      xAxis: {
        show: false,
        max: 100,
        min: 0,
      },
      yAxis: {
        data: ['进度'],
        show: false,
      },
      series: {
        type: 'bar',
        data: [78],
        barWidth: 10,
        itemStyle: {
          color: 'pink',
        },
        showBackground: true,
        label: {
          show: true,
          formatter: '|',
          position: 'right',
          color: 'pink',
        },
      },
      grid: {
        left: 0,
        right: 0,
      },
    };
    myEcharts.setOption(option);
  });
</script>
